#!/bin/sh
me=libtoolize-ltdl-no-la
if test -n "$VCPKG_LIBLTDL_LIBTOOLIZE"; then
    libtoolize="${VCPKG_LIBLTDL_LIBTOOLIZE}"
elif hash glibtoolize 2>/dev/null; then
    libtoolize=glibtoolize
else
    libtoolize=libtoolize
fi
echo "$me: running: ${libtoolize} $*" 1>&2
"${libtoolize}" "$@" &&
echo "$me: disabling libltdl.la check in m4/ltdl.m4" # most distros removes the la file
if test -f m4/ltdl.m4 ; then
    sed -e 's,test -f "\$with_ltdl_lib/libltdl.la",test -d "\$with_ltdl_lib",' m4/ltdl.m4 > m4/_ltdl.m4.tmp &&
    cp m4/_ltdl.m4.tmp m4/ltdl.m4 &&
    rm m4/_ltdl.m4.tmp
else
    echo "$me: Cannot find m4/libltdl.m4" 1>&2
fi
